///*
// *                 [[ Frozen-Bubble ]]
// *
// * Copyright (c) 2000-2003 Guillaume Cottenceau.
// * Java sourcecode - Copyright (c) 2003 Glenn Sanson.
// *
// * This code is distributed under the GNU General Public License
// *
// * This program is free software; you can redistribute it and/or
// * modify it under the terms of the GNU General Public License
// * version 2, as published by the Free Software Foundation.
// *
// * This program is distributed in the hope that it will be useful, but
// * WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// * General Public License for more details.
// *
// * You should have received a copy of the GNU General Public License along
// * with this program; if not, write to the Free Software Foundation, Inc.,
// * 675 Mass Ave, Cambridge, MA 02139, USA.
// *
// *
// * Artwork:
// *    Alexis Younes <73lab at free.fr>
// *      (everything but the bubbles)
// *    Amaury Amblard-Ladurantie <amaury at linuxfr.org>
// *      (the bubbles)
// *
// * Soundtrack:
// *    Matthias Le Bidan <matthias.le_bidan at caramail.com>
// *      (the three musics and all the sound effects)
// *
// * Design & Programming:
// *    Guillaume Cottenceau <guillaume.cottenceau at free.fr>
// *      (design and manage the project, whole Perl sourcecode)
// *
// * Java version:
// *    Glenn Sanson <glenn.sanson at free.fr>
// *      (whole Java sourcecode, including JIGA classes
// *             http://glenn.sanson.free.fr/jiga/)
// *
// * Android port:
// *    Pawel Aleksander Fedorynski <pfedor@fuw.edu.pl>
// *    Copyright (c) Google Inc.
// *
// *          [[ http://glenn.sanson.free.fr/fb/ ]]
// *          [[ http://www.frozen-bubble.org/   ]]
// */
//
//package com.example.lianliankdemo;
//
//import android.graphics.Canvas;
//import android.graphics.Point;
//import android.graphics.Rect;
//
///**
// * 泡泡精灵类
// */
//public class BubbleSprite extends Sprite {
//    private static double FALL_SPEED = 1.;
//    private static double MAX_BUBBLE_SPEED = 8.;
//    private static double MINIMUM_DISTANCE = 841.;
//
//    private int color;
//    private BmpWrap bubbleFace;
//    private BmpWrap bubbleBlindFace;
//    private BmpWrap frozenFace;
//    private BmpWrap bubbleBlink;
//    private BmpWrap[] bubbleFixed;
//    private FrozenGame frozen;
//    private BubbleManager bubbleManager;
//    private double moveX, moveY;
//    private double realX, realY;
//
//    private boolean fixed;
//    private boolean blink;
//    private boolean released;
//
//    private boolean checkJump;
//    private boolean checkFall;
//
//    private int fixedAnim;
//
//    public int getTypeId() {
//        return Sprite.TYPE_BUBBLE;
//    }
//
//    public BubbleSprite(Rect area, int color, double moveX, double moveY,
//                        double realX, double realY, boolean fixed, boolean blink,
//                        boolean released, boolean checkJump, boolean checkFall,
//                        int fixedAnim, BmpWrap bubbleFace,
//                        BmpWrap bubbleBlindFace, BmpWrap frozenFace,
//                        BmpWrap[] bubbleFixed, BmpWrap bubbleBlink,
//                        BubbleManager bubbleManager,
//                        FrozenGame frozen) {
//        super(area);
//        this.color = color;
//        this.moveX = moveX;
//        this.moveY = moveY;
//        this.realX = realX;
//        this.realY = realY;
//        this.fixed = fixed;
//        this.blink = blink;
//        this.released = released;
//        this.checkJump = checkJump;
//        this.checkFall = checkFall;
//        this.fixedAnim = fixedAnim;
//        this.bubbleFace = bubbleFace;
//        this.bubbleBlindFace = bubbleBlindFace;
//        this.frozenFace = frozenFace;
//        this.bubbleFixed = bubbleFixed;
//        this.bubbleBlink = bubbleBlink;
//        this.bubbleManager = bubbleManager;
//
//        this.frozen = frozen;
//    }
//
//    public BubbleSprite(Rect area, int direction, int color, BmpWrap bubbleFace,
//                        BmpWrap bubbleBlindFace, BmpWrap frozenFace,
//                        BmpWrap[] bubbleFixed, BmpWrap bubbleBlink,
//                        BubbleManager bubbleManager,
//                        FrozenGame frozen) {
//        super(area);
//
//        this.color = color;
//        this.bubbleFace = bubbleFace;
//        this.bubbleBlindFace = bubbleBlindFace;
//        this.frozenFace = frozenFace;
//        this.bubbleFixed = bubbleFixed;
//        this.bubbleBlink = bubbleBlink;
//        this.bubbleManager = bubbleManager;
//
//        this.frozen = frozen;
//
//        this.moveX = MAX_BUBBLE_SPEED * -Math.cos(direction * Math.PI / 40.);
//        this.moveY = MAX_BUBBLE_SPEED * -Math.sin(direction * Math.PI / 40.);
//        this.realX = area.left;
//        this.realY = area.top;
//
//        fixed = false;
//        fixedAnim = -1;
//    }
//
//    public BubbleSprite(Rect area, int color, BmpWrap bubbleFace,
//                        BmpWrap bubbleBlindFace, BmpWrap frozenFace,
//                        BmpWrap bubbleBlink, BubbleManager bubbleManager,
//                        FrozenGame frozen) {
//        super(area);
//
//        this.color = color;
//        this.bubbleFace = bubbleFace;
//        this.bubbleBlindFace = bubbleBlindFace;
//        this.frozenFace = frozenFace;
//        this.bubbleBlink = bubbleBlink;
//        this.bubbleManager = bubbleManager;
//
//        this.frozen = frozen;
//
//        this.realX = area.left;
//        this.realY = area.top;
//
//        fixed = true;
//        fixedAnim = -1;
//    }
//
//    Point currentPosition() {
//        int posY = (int) Math.floor((realY - 28. - frozen.getMoveDown()) / 28.);
//        int posX = (int) Math.floor((realX - 174.) / 32. + 0.5 * (posY % 2));
//
//        if (posX > 7) {
//            posX = 7;
//        }
//
//        if (posX < 0) {
//            posX = 0;
//        }
//
//        if (posY < 0) {
//            posY = 0;
//        }
//
//        return new Point(posX, posY);
//    }
//
//    public void blink() {
//        blink = true;
//    }
//
//    public void frozenify() {
//        changeSpriteArea(new Rect(getSpritePosition().x - 1, getSpritePosition().y - 1,
//                34, 42));
//        bubbleFace = frozenFace;
//    }
//
//    public final void paint(Canvas c, double scale, int dx, int dy) {
//        checkJump = false;
//        checkFall = false;
//
//        Point p = getSpritePosition();
//
//        if (blink && bubbleFace != frozenFace) {
//            blink = false;
//            drawImage(bubbleBlink, p.x, p.y, c, scale, dx, dy);
//        } else {
//            if (FrozenBubble.getMode() == FrozenBubble.GAME_NORMAL ||
//                    bubbleFace == frozenFace) {
//                drawImage(bubbleFace, p.x, p.y, c, scale, dx, dy);
//            } else {
//                drawImage(bubbleBlindFace, p.x, p.y, c, scale, dx, dy);
//            }
//        }
//
//        if (fixedAnim != -1) {
//            drawImage(bubbleFixed[fixedAnim], p.x, p.y, c, scale, dx, dy);
//            fixedAnim++;
//            if (fixedAnim == 6) {
//                fixedAnim = -1;
//            }
//        }
//    }
//}
